package br.com.mooble.activitys;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.RadioButton;
import br.com.mooble.R;

import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.Click;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.Fullscreen;
import com.googlecode.androidannotations.annotations.NoTitle;
import com.googlecode.androidannotations.annotations.ViewById;
import com.markupartist.android.widget.ActionBar;
import com.markupartist.android.widget.ActionBar.AbstractAction;

@NoTitle
@Fullscreen
@EActivity(R.layout.disciplina)
public class Disciplina extends Activity {

	@ViewById
	RadioButton radioHome;
	@ViewById
	RadioButton radioCalendario;
	@ViewById
	RadioButton radioForum;
	@ViewById
	RadioButton radioMais;
	@ViewById
	ActionBar actionBar;

	@AfterViews
	void inicializar() {		
		configurarActionBar();
		radioHome.setChecked(true);
	}

	private void configurarActionBar() {
		Intent i = this.getIntent();
		actionBar.setTitle(i.getStringExtra("nome"));
		actionBar.setHomeAction(new acaoVoltar());
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.addAction(new AcaoConfigurar());

	}

	public class acaoVoltar extends AbstractAction {

		public acaoVoltar() {
			super(R.drawable.ic_principal_barra);

		}

		public void performAction(View view) {
			Disciplina.this.finish();
			Disciplina.this
					.overridePendingTransition(R.anim.slide_entrando_esquerda,
							R.anim.slide_saindo_direita);

		}
	}

	public class AcaoConfigurar extends AbstractAction {

		public AcaoConfigurar() {
			super(R.drawable.gear);

		}

		public void performAction(View view) {

		}
	}

	@Click({ R.id.radioHome, R.id.radioCalendario, R.id.radioMais,R.id.radioForum })
	public void onCheckedChanged(View buttonView) {

		if (buttonView.getId() == R.id.radioCalendario) {
			Intent iCalendario = new Intent(Disciplina.this, Calendario_.class);
			Disciplina.this.startActivity(iCalendario);

		} else if (buttonView.getId() == R.id.radioForum) {
			Intent iForum = new Intent(Disciplina.this, Forum_.class);
			Disciplina.this.startActivity(iForum);

		}else if (buttonView.getId() == R.id.radioMais){
			Intent iMais = new Intent(Disciplina.this, Mais_.class);
			Disciplina.this.startActivity(iMais);
			
		}
		Disciplina.this.overridePendingTransition(
				R.anim.slide_entrando_direita, R.anim.slide_saindo_esquerda);
	}

}